int countCharacters(char** words, int wordsSize, char* chars) {
    char hashTableA[26] = {0};
    char hashTableB[26] = {0};
    int i,j;
    int cnt;
    int ret = 0;
    for(i = 0;chars[i] != '\0'; i++){
        hashTableA[chars[i]-'a']++;
    }

    for(i = 0;i < wordsSize; i++){
        cnt = 0;
        memcpy(hashTableB,hashTableA,sizeof(char)*26);
        for(j = 0; words[i][j] != '\0'; j++ ){
            if(hashTableB[words[i][j] - 'a']){
            cnt++;
            hashTableB[words[i][j] - 'a']--;
            }
        }
         if(cnt == j){
            ret += j;
         }
    }
    return ret;
}